package com.springblog.mapper;

import com.springblog.entity.BlogEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.springblog.entity.vo.BlogVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author ifredom@gmail.com
 * @since 2022-04-23
 */
@Mapper
public interface BlogMapper extends BaseMapper<BlogEntity>{

    // 使用注解写sql语句
    @Select("SELECT title FROM m_blog WHERE id = #{id}")
    BlogEntity selectBlog(long id);

    // 在xml中自定义sql语句
    BlogVo selectBlogAuthor(@Param("id") long id);

    // 在xml中自定义sql语句
    List<BlogVo> selectMenu(@Param("id") long id);
}
